package com.binance.autojob.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.env.ConfigurableEnvironment;

import com.binance.autojob.utils.JobClassInteruptor;

/**
 * 在spring context之前就要用环境变量
 * 
 * @author zhangwenhui
 *
 */
public class EnvironmentPreparedListner implements ApplicationListener<ApplicationEnvironmentPreparedEvent> {

    private static Logger logger = LoggerFactory.getLogger(JobClassInteruptor.class);

    public static ConfigurableEnvironment ENV;

    @Override
    public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
        ENV = event.getEnvironment();
        logger.info("********EnvironmentPreparedListner---->get  ENV! ");
    }

}
